
import { deepCopy } from "../deepCopy";
import { DETAIL_INIT, GET_USER, ADDTOCART } from "../actionCreators/actionTypes";

export let detailReducer = (state = {
    user: '',
    goods: null
}, action) => {
    let newState = deepCopy(state);
    switch (action.type) {
        case DETAIL_INIT:
            newState.goods = action.goods;
            return newState;
        case GET_USER:
            newState.user = action.user;
            return newState;
        default:
            return state;
    }
}